public class classTest{
    public static void main(String[] args) {
        // 实例化一个对象 传入构造方法所需的参数
        Dog cat = new Dog("haha");
        cat.barking();
        cat.setAge(5);
        System.out.println("getAge : "+cat.getAge());
        cat.aboutMe();
    }
}

class Dog{

    String name;
    int age;
    // 构造方法：在对象实例化的时候自动运行
    public Dog(String s){
        this.name = s;
    }

    public void barking(){
        System.out.println("汪汪");
    }

    public void setAge(int n){
        age = n;
    }

    public int getAge(){
        return age;
    }

    public void aboutMe(){
        System.out.println("name ："+name+"| age: "+age);
    }
}